<template>
	<el-drawer title="票据详情" v-model="visible" :size="800" destroy-on-close @closed="$emit('closed')">
		<el-container v-loading="loading">
			<el-main>
				<el-form>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="关联合同" prop="contractId">{{form.title}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="发票类型" prop="billType">{{form.billTypeName}}</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="票据编号" prop="billCode">{{form.billCode}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="票据事件" prop="isOpen">
								<el-tag type="danger" effect="dark" v-if="form.isOpen =='1'">开票</el-tag>
								<el-tag type="success" effect="dark" v-if="form.isOpen=='2'">收票</el-tag>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="开票日期" prop="billTime">{{form.billTime}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="开票金额" prop="total">{{form.total}}/元</el-form-item>
						</el-col>
					</el-row>
					<el-form-item label="开票备注">
						<div v-html="form.remark"></div>
					</el-form-item>
					<el-form-item label="相关附件" v-if="form.attachId!=''">
						<attach-menu :attachIds="form.attachId" :roleFlag="3" :preview="true" ></attach-menu>
					</el-form-item>
				</el-form>
				<el-footer style="text-align: center;">
					<el-button @click="visible=false">关闭</el-button>
				</el-footer>
			</el-main>
		</el-container>
	</el-drawer>
</template>

<script>
import AttachMenu from '@/views/module/attachMenu'
export default {
	emits: ['success', 'closed'],
	components: {
		AttachMenu,
	},
	data() {
		return {
			loading: false,
			form: {
				billId:"",
				contractId:"",
				customerName:'',
				billCode:'',
				billTypeName:'',
				isOpen: '1',
				billTime: '',
				total: 0,
				remark: '',
				attachId: ''
			},
			visible: false,
			isSaveing: false,
		}
	},
	mounted() {

	},
	methods: {
		//显示
		open(model){
			this.model=model;
			this.visible = true;
			return this;
		},
		setData(data){
			this.form.billId = data.billId
			this.form.contractId=data.contractId
			this.form.title=data.title
			this.form.billCode=data.billCode
			this.form.billTypeName=data.billTypeName
			this.form.isOpen=data.isOpen
			this.form.billTime=data.billTime
			this.form.total=data.total
			this.form.attachId=data.attachId
			this.form.remark=data.remark
		},
	}
}
</script>

<style>
</style>
